package org.toycode.solr.entity;

import java.io.IOException;
import java.io.Serializable;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.search.SortField;
import org.apache.solr.client.solrj.beans.Field;
import org.apache.solr.request.TextResponseWriter;
import org.apache.solr.request.XMLWriter;
import org.apache.solr.schema.FieldType;
import org.apache.solr.schema.SchemaField;

/**
 * Abstract base entity for indexing and searching.
 *
 * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
 * @version 1.0.0.2, Aug 27, 2009
 */
abstract public class AbstractEntity extends FieldType implements Serializable {

    /**
     * generated default serial version id.
     */
    private static final long serialVersionUID = 1L;
    /**
     * specifies the solr query type. 
     */
    @Field
    protected String type = this.getClass().getSimpleName();

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public void write(XMLWriter arg0, String arg1, Fieldable arg2) throws
            IOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void write(TextResponseWriter arg0, String arg1, Fieldable arg2)
            throws IOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public SortField getSortField(SchemaField arg0, boolean arg1) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
